<include file="Public:header" />
<link href="__PUBLIC__/Catalog/css/findPass.css" rel="stylesheet" type="text/css" />
</head>
<body>
<div class="main">
   <div class="title">
         <div class="title1">
             <a href="{:U('Membership/index')}" id="back"> < </a>找回密码
         </div>
   </div>
   <div class="reg">
        <div class="reg2">
            <ul>
            	<form action="{:U('Membership/forgetpwd')}" id="forgetpwd" method="post">
            		   <li><span class="sp_p1">手机号</span> <span class="sp_p2"><input type="tel" id="tel" value="{$tel}" name="tel" placeholder="请输入注册账号的手机号码" required/></span></li>
		               <li>
		                   <span class="sp_y1">验证码</span> 
		                   <span class="sp_y2">
		                   		<input type="text" name="yanzheng" id="yanzheng" maxlength="6" value="" placeholder="请输入验证码"  required/>
		                   		<input type="hidden" name="yanzhengagain" id="yanzhengagain" value="" />
		                   </span>
		                   <span class="sp_y3" id="yzbutton">获取验证码</span>
		               </li>
		               
		               <li><span class="sp_p1">新密码</span> <span class="sp_p2"><input type="password" id="pwd" name="pwd" placeholder="请输入新的密码" required/></span></li>
		               <li><span class="sp_p1">密码确认</span> <span class="sp_p2"><input type="password" id="pwdagain" name="pwdagain" placeholder="请再次输入新的密码" required/></span></li>
		               <li id="sub"><input type="button" id="tijiao" value="提交" /></li>
            	</form>
              
            </ul>
        </div>
   </div>
</div>
<script>
$('#yzbutton').bind("click",function(){
	var tel = $('#tel').val();
	$.ajax({
		type:"post",
		url:"{:U('Membership/sendyzm')}",
		datatype:'json',
		data:{tel:tel},
		success:function(result){
			datacontent =window.JSON.parse(result);
			if(datacontent.flag==1){
				alert(datacontent.msg);
			}else {
				$('#yanzhengagain').val(datacontent.yanzhengma);
				alert(datacontent.msg+datacontent.yanzhengma);
			}
			
		},
		error: function(XMLHttpRequest, textStatus, errorThrown) {
			alert(XMLHttpRequest.status);
			alert(XMLHttpRequest.readyState);
			alert(textStatus);
		},
	});
});

$('#tijiao').bind("click",function(){
	var yanzheng = $('#yanzheng').val();
	var yanzhengagain = $('#yanzhengagain').val();
	var pwd = $('#pwd').val();
	var pwdagain=$('#pwdagain').val();
	if(yanzheng!=yanzhengagain){
		alert('验证码输入错误！');
	}else if(pwd==''&&pwd!=pwdagain){
		alert('两次输入的密码不同!');
	}else{
		$('#forgetpwd').submit();
	}
	
});
</script>
<include file="Public:footer" />